<?php

namespace App\Http\Controllers\Order;

use App\Http\Controllers\BaseController;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;


class ContractPreviewExtend extends BaseController
{
    public function update(Request $request){
        $param = $request->only(['letter_total_weight','letter_no','receive_person','receive_person_phone','letter_date','id']);
        if(empty($param['id'])){
            return $this->response()->json(["code"=>"001","msg"=>"请求异常"]);
        }
        $ContractPreviewExtend = \App\Models\Order\ContractPreviewExtend::where('id',$param["id"])->first();
        if(empty($ContractPreviewExtend)){
            return $this->response()->json(["code"=>"001","msg"=>"数据异常"]);
        }
        unset($param["id"]);
        $res = \App\Models\Order\ContractPreviewExtend::where('id',$param["id"])->update($param);
        if($res !== false){
            return $this->response()->json(["code"=>"000","msg"=>"保存成功"]);
        }else{
            return $this->response()->json(["code"=>"001","msg"=>"保存失败"]);
        }
    }
}
